package com.situ.mall.address.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.situ.mall.address.model.AddressModel;
import com.situ.mall.address.service.impl.AddressServiceImpl;

import net.sf.json.JSONArray;

@Controller
@RequestMapping("address")
public class AddressController {

	@Autowired
	private AddressServiceImpl addressServiceImpl;
	
	@RequestMapping(value = "/list",produces = {"application/json;charset=UTF-8"})
	@ResponseBody
	public List<AddressModel> list(AddressModel model){
		List<AddressModel> res = addressServiceImpl.selectList(model);
		res = JSONArray.fromObject(res);
		return res;
	}
	
	@RequestMapping(value = "/test",produces = {"application/json;charset=UTF-8"})
	@ResponseBody
	public List<AddressModel> test(AddressModel model){
		List<AddressModel> res = addressServiceImpl.selectTest(model);
		res = JSONArray.fromObject(res);
		return res;
	}
}
